package work2;

import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class PWDemo2 {
    public static void main(String[] args) throws FileNotFoundException {
        FileOutputStream fos1=new FileOutputStream("test.txt");
        OutputStreamWriter osw1=new OutputStreamWriter(fos1, StandardCharsets.UTF_8);
        BufferedWriter bw1=new BufferedWriter(osw1);
        PrintWriter pw1=new PrintWriter(bw1);
        Scanner scan=new Scanner(System.in);
        while (true){
            String line1=scan.nextLine();
            if("exit".equals(line1)){
                pw1.close();
                break;
            }
            pw1.println(line1);
        }
    }


}
